
var Sequelize = require('sequelize')
    , sequelize = new Sequelize('crowdsourceapp', 'root', '', {
        dialect: "mysql", // or 'sqlite', 'postgres', 'mariadb'
        port:    3306, // or 5432 (for postgres)
    })

sequelize
    .authenticate();

var Project = sequelize.define('Project', {
    title: Sequelize.STRING,
    description: Sequelize.TEXT
})
var QuestionNaire = sequelize.define('QuestionNaire', { Content: {type:Sequelize.TEXT,allowNull: false},Title: {type:Sequelize.TEXT,allowNull: false}})
//QuestionNaire.sync({force: true}).then(function () {
//    // Table created
//});
var QuestionNaireAnswer = sequelize.define('QuestionNaireAnswer', { Answer: {type:Sequelize.TEXT,allowNull: false},QnId: {type:Sequelize.INTEGER,allowNull: false}})
//QuestionNaireAnswer .sync({force: true}).then(function () {
//    // Table created
//});

function QuestionNaire() {
    return QuestionNaire;
}
function QuestionNaireAnswer() {
    return QuestionNaireAnswer;
}
//User
//    .create({
//      username: 'lxc',
//      password: 'lxc12345'
//    });
//User.all({
//    attributes: ['']
//}).then(function (user) {
//  console.log(user);
//});

/* GET home page. */
exports.QuestionNaire=QuestionNaire;
exports.QuestionNaireAnswer=QuestionNaireAnswer;
